package com.message.tcp.ip.ui.member;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import com.message.tcp.ip.ui.bin.panel.BinPanel;
import com.message.tcp.ip.ui.bin.panel.BinTable;
import com.message.tcp.ip.ui.member.dialog.AccountTable;
import com.message.tcp.ip.ui.member.dialog.MemberTable;
import com.message.tcp.ip.ui.member.dialog.TransactionTable;
import com.message.tcp.ip.ui.member.menu.ConfigureMenuBar;

public class EnviromentDailog extends JDialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private final JPanel contentPanel = new JPanel();
	private ConfigureMenuBar menuBar;
	private ConfigureTabbedPane contentTabbedPane;
	/**
	 * Create the dialog.
	 */
	public EnviromentDailog() {
		//setModal(true);
		setTitle("Parameter Setup");
		setBounds(100, 100, 915, 469);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new BorderLayout(0, 0));
		// table component
		MemberTable memberTable = new MemberTable();
		BinTable binTable = new BinTable();
		AccountTable accountTable = new AccountTable();
		TransactionTable transactionTable = new TransactionTable();
		
		// panel component
		MemberPanel memberPanel = new MemberPanel(memberTable);
		BinPanel binPanel = new BinPanel(binTable);
		
		AccountPanel accountPanel = new AccountPanel(accountTable);
		TransactionPanel transactionPanel = new TransactionPanel(transactionTable);
		
		// controller
		
		contentTabbedPane = new ConfigureTabbedPane(memberPanel,binPanel,accountPanel, transactionPanel);
		menuBar = new ConfigureMenuBar(memberTable,binTable,accountTable,transactionTable);
		
		contentPanel.add(menuBar, BorderLayout.NORTH);
		contentPanel.add(contentTabbedPane, BorderLayout.CENTER);
		
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton okButton = new JButton("OK");
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}
			{
				JButton cancelButton = new JButton("Cancel");
				cancelButton.setActionCommand("Cancel");
				cancelButton.addActionListener(new ActionListener(){
					@Override
					public void actionPerformed(ActionEvent e) {
						dispose();
					}
					
				});
				buttonPane.add(cancelButton);
			}
		}
	}
}
